<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib  uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>循环</title>
</head>
<body>
        <%--向域对象添加集合--%>
        <%
            ArrayList<String>list = new ArrayList<>();
            list.add("a");
            list.add("c");
            list.add("b");
            list.add("d");
            pageContext.setAttribute("list",list);
        %>

        <%--遍历集合--%>
        <c:forEach items="${list}" var="s">
            ${s}<br/>
        </c:forEach>
</body>
</html>
